<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>路由管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function checkValidate()
		{


			var selectObj=document.getElementById("subnetId");
			var subnetId=selectObj.options[selectObj.selectedIndex].value;

			//判断是否为空

			if(subnetId==null||subnetId=="")
			{
				window.alertx("请选择子网！");
				return false;
			}


		}
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/scene/sceneRouter/">路由列表</a></li>
		<li class="active"><a href="${ctx}/scene/sceneRouter/addInterface?id=${sceneRouter.id}">增加接口</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="sceneRouter" action="${ctx}/scene/sceneRouter/saveInterface" method="post" class="form-horizontal">
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">子网：</label>
			<div class="controls">
				<select id="subnetId" name="subnetId" class="input-xlarge">
					<option value="" selected>===请选择===</option>
					<c:forEach var="subnet" items="${subnetList}">
						<option value="${subnet.id}">${subnet.networkName}:${subnet.cidr}(${subnet.subnetName})</option>
					</c:forEach>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">路由名称：</label>
			<div class="controls">
				<form:input path="routerName" htmlEscape="false" maxlength="64" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">路由id：</label>
			<div class="controls">
				<form:input path="id" htmlEscape="false" maxlength="64" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="scene:sceneRouter:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick=" return checkValidate()"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>